| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 1 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" | 
|  | 2 | "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> | 
|  | 3 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> | 
|  | 4 | <head> | 
|  | 5 | <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8" /> | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 6 | <meta name="generator" content="AsciiDoc 8.6.9" /> | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 7 | <title>HTTP transfer protocols</title> | 
|  | 8 | <style type="text/css"> | 
|  | 9 | /* Shared CSS for AsciiDoc xhtml11 and html5 backends */ | 
|  | 10 |  | 
|  | 11 | /* Default font. */ | 
|  | 12 | body { | 
|  | 13 | font-family: Georgia,serif; | 
|  | 14 | } | 
|  | 15 |  | 
|  | 16 | /* Title font. */ | 
|  | 17 | h1, h2, h3, h4, h5, h6, | 
|  | 18 | div.title, caption.title, | 
|  | 19 | thead, p.table.header, | 
|  | 20 | #toctitle, | 
|  | 21 | #author, #revnumber, #revdate, #revremark, | 
|  | 22 | #footer { | 
|  | 23 | font-family: Arial,Helvetica,sans-serif; | 
|  | 24 | } | 
|  | 25 |  | 
|  | 26 | body { | 
|  | 27 | margin: 1em 5% 1em 5%; | 
|  | 28 | } | 
|  | 29 |  | 
|  | 30 | a { | 
|  | 31 | color: blue; | 
|  | 32 | text-decoration: underline; | 
|  | 33 | } | 
|  | 34 | a:visited { | 
|  | 35 | color: fuchsia; | 
|  | 36 | } | 
|  | 37 |  | 
|  | 38 | em { | 
|  | 39 | font-style: italic; | 
|  | 40 | color: navy; | 
|  | 41 | } | 
|  | 42 |  | 
|  | 43 | strong { | 
|  | 44 | font-weight: bold; | 
|  | 45 | color: #083194; | 
|  | 46 | } | 
|  | 47 |  | 
|  | 48 | h1, h2, h3, h4, h5, h6 { | 
|  | 49 | color: #527bbd; | 
|  | 50 | margin-top: 1.2em; | 
|  | 51 | margin-bottom: 0.5em; | 
|  | 52 | line-height: 1.3; | 
|  | 53 | } | 
|  | 54 |  | 
|  | 55 | h1, h2, h3 { | 
|  | 56 | border-bottom: 2px solid silver; | 
|  | 57 | } | 
|  | 58 | h2 { | 
|  | 59 | padding-top: 0.5em; | 
|  | 60 | } | 
|  | 61 | h3 { | 
|  | 62 | float: left; | 
|  | 63 | } | 
|  | 64 | h3 + * { | 
|  | 65 | clear: left; | 
|  | 66 | } | 
|  | 67 | h5 { | 
|  | 68 | font-size: 1.0em; | 
|  | 69 | } | 
|  | 70 |  | 
|  | 71 | div.sectionbody { | 
|  | 72 | margin-left: 0; | 
|  | 73 | } | 
|  | 74 |  | 
|  | 75 | hr { | 
|  | 76 | border: 1px solid silver; | 
|  | 77 | } | 
|  | 78 |  | 
|  | 79 | p { | 
|  | 80 | margin-top: 0.5em; | 
|  | 81 | margin-bottom: 0.5em; | 
|  | 82 | } | 
|  | 83 |  | 
|  | 84 | ul, ol, li > p { | 
|  | 85 | margin-top: 0; | 
|  | 86 | } | 
|  | 87 | ul > li { color: #aaa; } | 
|  | 88 | ul > li > * { color: black; } | 
|  | 89 |  | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 90 | .monospaced, code, pre { | 
|  | 91 | font-family: "Courier New", Courier, monospace; | 
|  | 92 | font-size: inherit; | 
|  | 93 | color: navy; | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 94 | padding: 0; | 
|  | 95 | margin: 0; | 
|  | 96 | } | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 97 | pre { | 
|  | 98 | white-space: pre-wrap; | 
|  | 99 | } | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 100 |  | 
|  | 101 | #author { | 
|  | 102 | color: #527bbd; | 
|  | 103 | font-weight: bold; | 
|  | 104 | font-size: 1.1em; | 
|  | 105 | } | 
|  | 106 | #email { | 
|  | 107 | } | 
|  | 108 | #revnumber, #revdate, #revremark { | 
|  | 109 | } | 
|  | 110 |  | 
|  | 111 | #footer { | 
|  | 112 | font-size: small; | 
|  | 113 | border-top: 2px solid silver; | 
|  | 114 | padding-top: 0.5em; | 
|  | 115 | margin-top: 4.0em; | 
|  | 116 | } | 
|  | 117 | #footer-text { | 
|  | 118 | float: left; | 
|  | 119 | padding-bottom: 0.5em; | 
|  | 120 | } | 
|  | 121 | #footer-badges { | 
|  | 122 | float: right; | 
|  | 123 | padding-bottom: 0.5em; | 
|  | 124 | } | 
|  | 125 |  | 
|  | 126 | #preamble { | 
|  | 127 | margin-top: 1.5em; | 
|  | 128 | margin-bottom: 1.5em; | 
|  | 129 | } | 
|  | 130 | div.imageblock, div.exampleblock, div.verseblock, | 
|  | 131 | div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock, | 
|  | 132 | div.admonitionblock { | 
|  | 133 | margin-top: 1.0em; | 
|  | 134 | margin-bottom: 1.5em; | 
|  | 135 | } | 
|  | 136 | div.admonitionblock { | 
|  | 137 | margin-top: 2.0em; | 
|  | 138 | margin-bottom: 2.0em; | 
|  | 139 | margin-right: 10%; | 
|  | 140 | color: #606060; | 
|  | 141 | } | 
|  | 142 |  | 
|  | 143 | div.content { /* Block element content. */ | 
|  | 144 | padding: 0; | 
|  | 145 | } | 
|  | 146 |  | 
|  | 147 | /* Block element titles. */ | 
|  | 148 | div.title, caption.title { | 
|  | 149 | color: #527bbd; | 
|  | 150 | font-weight: bold; | 
|  | 151 | text-align: left; | 
|  | 152 | margin-top: 1.0em; | 
|  | 153 | margin-bottom: 0.5em; | 
|  | 154 | } | 
|  | 155 | div.title + * { | 
|  | 156 | margin-top: 0; | 
|  | 157 | } | 
|  | 158 |  | 
|  | 159 | td div.title:first-child { | 
|  | 160 | margin-top: 0.0em; | 
|  | 161 | } | 
|  | 162 | div.content div.title:first-child { | 
|  | 163 | margin-top: 0.0em; | 
|  | 164 | } | 
|  | 165 | div.content + div.title { | 
|  | 166 | margin-top: 0.0em; | 
|  | 167 | } | 
|  | 168 |  | 
|  | 169 | div.sidebarblock > div.content { | 
|  | 170 | background: #ffffee; | 
|  | 171 | border: 1px solid #dddddd; | 
|  | 172 | border-left: 4px solid #f0f0f0; | 
|  | 173 | padding: 0.5em; | 
|  | 174 | } | 
|  | 175 |  | 
|  | 176 | div.listingblock > div.content { | 
|  | 177 | border: 1px solid #dddddd; | 
|  | 178 | border-left: 5px solid #f0f0f0; | 
|  | 179 | background: #f8f8f8; | 
|  | 180 | padding: 0.5em; | 
|  | 181 | } | 
|  | 182 |  | 
|  | 183 | div.quoteblock, div.verseblock { | 
|  | 184 | padding-left: 1.0em; | 
|  | 185 | margin-left: 1.0em; | 
|  | 186 | margin-right: 10%; | 
|  | 187 | border-left: 5px solid #f0f0f0; | 
|  | 188 | color: #888; | 
|  | 189 | } | 
|  | 190 |  | 
|  | 191 | div.quoteblock > div.attribution { | 
|  | 192 | padding-top: 0.5em; | 
|  | 193 | text-align: right; | 
|  | 194 | } | 
|  | 195 |  | 
|  | 196 | div.verseblock > pre.content { | 
|  | 197 | font-family: inherit; | 
|  | 198 | font-size: inherit; | 
|  | 199 | } | 
|  | 200 | div.verseblock > div.attribution { | 
|  | 201 | padding-top: 0.75em; | 
|  | 202 | text-align: left; | 
|  | 203 | } | 
|  | 204 | /* DEPRECATED: Pre version 8.2.7 verse style literal block. */ | 
|  | 205 | div.verseblock + div.attribution { | 
|  | 206 | text-align: left; | 
|  | 207 | } | 
|  | 208 |  | 
|  | 209 | div.admonitionblock .icon { | 
|  | 210 | vertical-align: top; | 
|  | 211 | font-size: 1.1em; | 
|  | 212 | font-weight: bold; | 
|  | 213 | text-decoration: underline; | 
|  | 214 | color: #527bbd; | 
|  | 215 | padding-right: 0.5em; | 
|  | 216 | } | 
|  | 217 | div.admonitionblock td.content { | 
|  | 218 | padding-left: 0.5em; | 
|  | 219 | border-left: 3px solid #dddddd; | 
|  | 220 | } | 
|  | 221 |  | 
|  | 222 | div.exampleblock > div.content { | 
|  | 223 | border-left: 3px solid #dddddd; | 
|  | 224 | padding-left: 0.5em; | 
|  | 225 | } | 
|  | 226 |  | 
|  | 227 | div.imageblock div.content { padding-left: 0; } | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 228 | span.image img { border-style: none; vertical-align: text-bottom; } | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 229 | a.image:visited { color: white; } | 
|  | 230 |  | 
|  | 231 | dl { | 
|  | 232 | margin-top: 0.8em; | 
|  | 233 | margin-bottom: 0.8em; | 
|  | 234 | } | 
|  | 235 | dt { | 
|  | 236 | margin-top: 0.5em; | 
|  | 237 | margin-bottom: 0; | 
|  | 238 | font-style: normal; | 
|  | 239 | color: navy; | 
|  | 240 | } | 
|  | 241 | dd > *:first-child { | 
|  | 242 | margin-top: 0.1em; | 
|  | 243 | } | 
|  | 244 |  | 
|  | 245 | ul, ol { | 
|  | 246 | list-style-position: outside; | 
|  | 247 | } | 
|  | 248 | ol.arabic { | 
|  | 249 | list-style-type: decimal; | 
|  | 250 | } | 
|  | 251 | ol.loweralpha { | 
|  | 252 | list-style-type: lower-alpha; | 
|  | 253 | } | 
|  | 254 | ol.upperalpha { | 
|  | 255 | list-style-type: upper-alpha; | 
|  | 256 | } | 
|  | 257 | ol.lowerroman { | 
|  | 258 | list-style-type: lower-roman; | 
|  | 259 | } | 
|  | 260 | ol.upperroman { | 
|  | 261 | list-style-type: upper-roman; | 
|  | 262 | } | 
|  | 263 |  | 
|  | 264 | div.compact ul, div.compact ol, | 
|  | 265 | div.compact p, div.compact p, | 
|  | 266 | div.compact div, div.compact div { | 
|  | 267 | margin-top: 0.1em; | 
|  | 268 | margin-bottom: 0.1em; | 
|  | 269 | } | 
|  | 270 |  | 
|  | 271 | tfoot { | 
|  | 272 | font-weight: bold; | 
|  | 273 | } | 
|  | 274 | td > div.verse { | 
|  | 275 | white-space: pre; | 
|  | 276 | } | 
|  | 277 |  | 
|  | 278 | div.hdlist { | 
|  | 279 | margin-top: 0.8em; | 
|  | 280 | margin-bottom: 0.8em; | 
|  | 281 | } | 
|  | 282 | div.hdlist tr { | 
|  | 283 | padding-bottom: 15px; | 
|  | 284 | } | 
|  | 285 | dt.hdlist1.strong, td.hdlist1.strong { | 
|  | 286 | font-weight: bold; | 
|  | 287 | } | 
|  | 288 | td.hdlist1 { | 
|  | 289 | vertical-align: top; | 
|  | 290 | font-style: normal; | 
|  | 291 | padding-right: 0.8em; | 
|  | 292 | color: navy; | 
|  | 293 | } | 
|  | 294 | td.hdlist2 { | 
|  | 295 | vertical-align: top; | 
|  | 296 | } | 
|  | 297 | div.hdlist.compact tr { | 
|  | 298 | margin: 0; | 
|  | 299 | padding-bottom: 0; | 
|  | 300 | } | 
|  | 301 |  | 
|  | 302 | .comment { | 
|  | 303 | background: yellow; | 
|  | 304 | } | 
|  | 305 |  | 
|  | 306 | .footnote, .footnoteref { | 
|  | 307 | font-size: 0.8em; | 
|  | 308 | } | 
|  | 309 |  | 
|  | 310 | span.footnote, span.footnoteref { | 
|  | 311 | vertical-align: super; | 
|  | 312 | } | 
|  | 313 |  | 
|  | 314 | #footnotes { | 
|  | 315 | margin: 20px 0 20px 0; | 
|  | 316 | padding: 7px 0 0 0; | 
|  | 317 | } | 
|  | 318 |  | 
|  | 319 | #footnotes div.footnote { | 
|  | 320 | margin: 0 0 5px 0; | 
|  | 321 | } | 
|  | 322 |  | 
|  | 323 | #footnotes hr { | 
|  | 324 | border: none; | 
|  | 325 | border-top: 1px solid silver; | 
|  | 326 | height: 1px; | 
|  | 327 | text-align: left; | 
|  | 328 | margin-left: 0; | 
|  | 329 | width: 20%; | 
|  | 330 | min-width: 100px; | 
|  | 331 | } | 
|  | 332 |  | 
|  | 333 | div.colist td { | 
|  | 334 | padding-right: 0.5em; | 
|  | 335 | padding-bottom: 0.3em; | 
|  | 336 | vertical-align: top; | 
|  | 337 | } | 
|  | 338 | div.colist td img { | 
|  | 339 | margin-top: 0.3em; | 
|  | 340 | } | 
|  | 341 |  | 
|  | 342 | @media print { | 
|  | 343 | #footer-badges { display: none; } | 
|  | 344 | } | 
|  | 345 |  | 
|  | 346 | #toc { | 
|  | 347 | margin-bottom: 2.5em; | 
|  | 348 | } | 
|  | 349 |  | 
|  | 350 | #toctitle { | 
|  | 351 | color: #527bbd; | 
|  | 352 | font-size: 1.1em; | 
|  | 353 | font-weight: bold; | 
|  | 354 | margin-top: 1.0em; | 
|  | 355 | margin-bottom: 0.1em; | 
|  | 356 | } | 
|  | 357 |  | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 358 | div.toclevel0, div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 { | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 359 | margin-top: 0; | 
|  | 360 | margin-bottom: 0; | 
|  | 361 | } | 
|  | 362 | div.toclevel2 { | 
|  | 363 | margin-left: 2em; | 
|  | 364 | font-size: 0.9em; | 
|  | 365 | } | 
|  | 366 | div.toclevel3 { | 
|  | 367 | margin-left: 4em; | 
|  | 368 | font-size: 0.9em; | 
|  | 369 | } | 
|  | 370 | div.toclevel4 { | 
|  | 371 | margin-left: 6em; | 
|  | 372 | font-size: 0.9em; | 
|  | 373 | } | 
|  | 374 |  | 
|  | 375 | span.aqua { color: aqua; } | 
|  | 376 | span.black { color: black; } | 
|  | 377 | span.blue { color: blue; } | 
|  | 378 | span.fuchsia { color: fuchsia; } | 
|  | 379 | span.gray { color: gray; } | 
|  | 380 | span.green { color: green; } | 
|  | 381 | span.lime { color: lime; } | 
|  | 382 | span.maroon { color: maroon; } | 
|  | 383 | span.navy { color: navy; } | 
|  | 384 | span.olive { color: olive; } | 
|  | 385 | span.purple { color: purple; } | 
|  | 386 | span.red { color: red; } | 
|  | 387 | span.silver { color: silver; } | 
|  | 388 | span.teal { color: teal; } | 
|  | 389 | span.white { color: white; } | 
|  | 390 | span.yellow { color: yellow; } | 
|  | 391 |  | 
|  | 392 | span.aqua-background { background: aqua; } | 
|  | 393 | span.black-background { background: black; } | 
|  | 394 | span.blue-background { background: blue; } | 
|  | 395 | span.fuchsia-background { background: fuchsia; } | 
|  | 396 | span.gray-background { background: gray; } | 
|  | 397 | span.green-background { background: green; } | 
|  | 398 | span.lime-background { background: lime; } | 
|  | 399 | span.maroon-background { background: maroon; } | 
|  | 400 | span.navy-background { background: navy; } | 
|  | 401 | span.olive-background { background: olive; } | 
|  | 402 | span.purple-background { background: purple; } | 
|  | 403 | span.red-background { background: red; } | 
|  | 404 | span.silver-background { background: silver; } | 
|  | 405 | span.teal-background { background: teal; } | 
|  | 406 | span.white-background { background: white; } | 
|  | 407 | span.yellow-background { background: yellow; } | 
|  | 408 |  | 
|  | 409 | span.big { font-size: 2em; } | 
|  | 410 | span.small { font-size: 0.6em; } | 
|  | 411 |  | 
|  | 412 | span.underline { text-decoration: underline; } | 
|  | 413 | span.overline { text-decoration: overline; } | 
|  | 414 | span.line-through { text-decoration: line-through; } | 
|  | 415 |  | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 416 | div.unbreakable { page-break-inside: avoid; } | 
|  | 417 |  | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 418 |  | 
|  | 419 | /* | 
|  | 420 | * xhtml11 specific | 
|  | 421 | * | 
|  | 422 | * */ | 
|  | 423 |  | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 424 | div.tableblock { | 
|  | 425 | margin-top: 1.0em; | 
|  | 426 | margin-bottom: 1.5em; | 
|  | 427 | } | 
|  | 428 | div.tableblock > table { | 
|  | 429 | border: 3px solid #527bbd; | 
|  | 430 | } | 
|  | 431 | thead, p.table.header { | 
|  | 432 | font-weight: bold; | 
|  | 433 | color: #527bbd; | 
|  | 434 | } | 
|  | 435 | p.table { | 
|  | 436 | margin-top: 0; | 
|  | 437 | } | 
|  | 438 | /* Because the table frame attribute is overriden by CSS in most browsers. */ | 
|  | 439 | div.tableblock > table[frame="void"] { | 
|  | 440 | border-style: none; | 
|  | 441 | } | 
|  | 442 | div.tableblock > table[frame="hsides"] { | 
|  | 443 | border-left-style: none; | 
|  | 444 | border-right-style: none; | 
|  | 445 | } | 
|  | 446 | div.tableblock > table[frame="vsides"] { | 
|  | 447 | border-top-style: none; | 
|  | 448 | border-bottom-style: none; | 
|  | 449 | } | 
|  | 450 |  | 
|  | 451 |  | 
|  | 452 | /* | 
|  | 453 | * html5 specific | 
|  | 454 | * | 
|  | 455 | * */ | 
|  | 456 |  | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 457 | table.tableblock { | 
|  | 458 | margin-top: 1.0em; | 
|  | 459 | margin-bottom: 1.5em; | 
|  | 460 | } | 
|  | 461 | thead, p.tableblock.header { | 
|  | 462 | font-weight: bold; | 
|  | 463 | color: #527bbd; | 
|  | 464 | } | 
|  | 465 | p.tableblock { | 
|  | 466 | margin-top: 0; | 
|  | 467 | } | 
|  | 468 | table.tableblock { | 
|  | 469 | border-width: 3px; | 
|  | 470 | border-spacing: 0px; | 
|  | 471 | border-style: solid; | 
|  | 472 | border-color: #527bbd; | 
|  | 473 | border-collapse: collapse; | 
|  | 474 | } | 
|  | 475 | th.tableblock, td.tableblock { | 
|  | 476 | border-width: 1px; | 
|  | 477 | padding: 4px; | 
|  | 478 | border-style: solid; | 
|  | 479 | border-color: #527bbd; | 
|  | 480 | } | 
|  | 481 |  | 
|  | 482 | table.tableblock.frame-topbot { | 
|  | 483 | border-left-style: hidden; | 
|  | 484 | border-right-style: hidden; | 
|  | 485 | } | 
|  | 486 | table.tableblock.frame-sides { | 
|  | 487 | border-top-style: hidden; | 
|  | 488 | border-bottom-style: hidden; | 
|  | 489 | } | 
|  | 490 | table.tableblock.frame-none { | 
|  | 491 | border-style: hidden; | 
|  | 492 | } | 
|  | 493 |  | 
|  | 494 | th.tableblock.halign-left, td.tableblock.halign-left { | 
|  | 495 | text-align: left; | 
|  | 496 | } | 
|  | 497 | th.tableblock.halign-center, td.tableblock.halign-center { | 
|  | 498 | text-align: center; | 
|  | 499 | } | 
|  | 500 | th.tableblock.halign-right, td.tableblock.halign-right { | 
|  | 501 | text-align: right; | 
|  | 502 | } | 
|  | 503 |  | 
|  | 504 | th.tableblock.valign-top, td.tableblock.valign-top { | 
|  | 505 | vertical-align: top; | 
|  | 506 | } | 
|  | 507 | th.tableblock.valign-middle, td.tableblock.valign-middle { | 
|  | 508 | vertical-align: middle; | 
|  | 509 | } | 
|  | 510 | th.tableblock.valign-bottom, td.tableblock.valign-bottom { | 
|  | 511 | vertical-align: bottom; | 
|  | 512 | } | 
|  | 513 |  | 
|  | 514 |  | 
|  | 515 | /* | 
|  | 516 | * manpage specific | 
|  | 517 | * | 
|  | 518 | * */ | 
|  | 519 |  | 
|  | 520 | body.manpage h1 { | 
|  | 521 | padding-top: 0.5em; | 
|  | 522 | padding-bottom: 0.5em; | 
|  | 523 | border-top: 2px solid silver; | 
|  | 524 | border-bottom: 2px solid silver; | 
|  | 525 | } | 
|  | 526 | body.manpage h2 { | 
|  | 527 | border-style: none; | 
|  | 528 | } | 
|  | 529 | body.manpage div.sectionbody { | 
|  | 530 | margin-left: 3em; | 
|  | 531 | } | 
|  | 532 |  | 
|  | 533 | @media print { | 
|  | 534 | body.manpage div#toc { display: none; } | 
|  | 535 | } | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 536 |  | 
|  | 537 |  | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 538 | </style> | 
|  | 539 | <script type="text/javascript"> | 
|  | 540 | /*<![CDATA[*/ | 
|  | 541 | var asciidoc = { // Namespace. | 
|  | 542 |  | 
|  | 543 | ///////////////////////////////////////////////////////////////////// | 
|  | 544 | // Table Of Contents generator | 
|  | 545 | ///////////////////////////////////////////////////////////////////// | 
|  | 546 |  | 
|  | 547 | /* Author: Mihai Bazon, September 2002 | 
|  | 548 | * http://students.infoiasi.ro/~mishoo | 
|  | 549 | * | 
|  | 550 | * Table Of Content generator | 
|  | 551 | * Version: 0.4 | 
|  | 552 | * | 
|  | 553 | * Feel free to use this script under the terms of the GNU General Public | 
|  | 554 | * License, as long as you do not remove or alter this notice. | 
|  | 555 | */ | 
|  | 556 |  | 
|  | 557 | /* modified by Troy D. Hanson, September 2006. License: GPL */ | 
|  | 558 | /* modified by Stuart Rackham, 2006, 2009. License: GPL */ | 
|  | 559 |  | 
|  | 560 | // toclevels = 1..4. | 
|  | 561 | toc: function (toclevels) { | 
|  | 562 |  | 
|  | 563 | function getText(el) { | 
|  | 564 | var text = ""; | 
|  | 565 | for (var i = el.firstChild; i != null; i = i.nextSibling) { | 
|  | 566 | if (i.nodeType == 3 /* Node.TEXT_NODE */) // IE doesn't speak constants. | 
|  | 567 | text += i.data; | 
|  | 568 | else if (i.firstChild != null) | 
|  | 569 | text += getText(i); | 
|  | 570 | } | 
|  | 571 | return text; | 
|  | 572 | } | 
|  | 573 |  | 
|  | 574 | function TocEntry(el, text, toclevel) { | 
|  | 575 | this.element = el; | 
|  | 576 | this.text = text; | 
|  | 577 | this.toclevel = toclevel; | 
|  | 578 | } | 
|  | 579 |  | 
|  | 580 | function tocEntries(el, toclevels) { | 
|  | 581 | var result = new Array; | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 582 | var re = new RegExp('[hH]([1-'+(toclevels+1)+'])'); | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 583 | // Function that scans the DOM tree for header elements (the DOM2 | 
|  | 584 | // nodeIterator API would be a better technique but not supported by all | 
|  | 585 | // browsers). | 
|  | 586 | var iterate = function (el) { | 
|  | 587 | for (var i = el.firstChild; i != null; i = i.nextSibling) { | 
|  | 588 | if (i.nodeType == 1 /* Node.ELEMENT_NODE */) { | 
|  | 589 | var mo = re.exec(i.tagName); | 
|  | 590 | if (mo && (i.getAttribute("class") || i.getAttribute("className")) != "float") { | 
|  | 591 | result[result.length] = new TocEntry(i, getText(i), mo[1]-1); | 
|  | 592 | } | 
|  | 593 | iterate(i); | 
|  | 594 | } | 
|  | 595 | } | 
|  | 596 | } | 
|  | 597 | iterate(el); | 
|  | 598 | return result; | 
|  | 599 | } | 
|  | 600 |  | 
|  | 601 | var toc = document.getElementById("toc"); | 
|  | 602 | if (!toc) { | 
|  | 603 | return; | 
|  | 604 | } | 
|  | 605 |  | 
|  | 606 | // Delete existing TOC entries in case we're reloading the TOC. | 
|  | 607 | var tocEntriesToRemove = []; | 
|  | 608 | var i; | 
|  | 609 | for (i = 0; i < toc.childNodes.length; i++) { | 
|  | 610 | var entry = toc.childNodes[i]; | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 611 | if (entry.nodeName.toLowerCase() == 'div' | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 612 | && entry.getAttribute("class") | 
|  | 613 | && entry.getAttribute("class").match(/^toclevel/)) | 
|  | 614 | tocEntriesToRemove.push(entry); | 
|  | 615 | } | 
|  | 616 | for (i = 0; i < tocEntriesToRemove.length; i++) { | 
|  | 617 | toc.removeChild(tocEntriesToRemove[i]); | 
|  | 618 | } | 
|  | 619 |  | 
|  | 620 | // Rebuild TOC entries. | 
|  | 621 | var entries = tocEntries(document.getElementById("content"), toclevels); | 
|  | 622 | for (var i = 0; i < entries.length; ++i) { | 
|  | 623 | var entry = entries[i]; | 
|  | 624 | if (entry.element.id == "") | 
|  | 625 | entry.element.id = "_toc_" + i; | 
|  | 626 | var a = document.createElement("a"); | 
|  | 627 | a.href = "#" + entry.element.id; | 
|  | 628 | a.appendChild(document.createTextNode(entry.text)); | 
|  | 629 | var div = document.createElement("div"); | 
|  | 630 | div.appendChild(a); | 
|  | 631 | div.className = "toclevel" + entry.toclevel; | 
|  | 632 | toc.appendChild(div); | 
|  | 633 | } | 
|  | 634 | if (entries.length == 0) | 
|  | 635 | toc.parentNode.removeChild(toc); | 
|  | 636 | }, | 
|  | 637 |  | 
|  | 638 |  | 
|  | 639 | ///////////////////////////////////////////////////////////////////// | 
|  | 640 | // Footnotes generator | 
|  | 641 | ///////////////////////////////////////////////////////////////////// | 
|  | 642 |  | 
|  | 643 | /* Based on footnote generation code from: | 
|  | 644 | * http://www.brandspankingnew.net/archive/2005/07/format_footnote.html | 
|  | 645 | */ | 
|  | 646 |  | 
|  | 647 | footnotes: function () { | 
|  | 648 | // Delete existing footnote entries in case we're reloading the footnodes. | 
|  | 649 | var i; | 
|  | 650 | var noteholder = document.getElementById("footnotes"); | 
|  | 651 | if (!noteholder) { | 
|  | 652 | return; | 
|  | 653 | } | 
|  | 654 | var entriesToRemove = []; | 
|  | 655 | for (i = 0; i < noteholder.childNodes.length; i++) { | 
|  | 656 | var entry = noteholder.childNodes[i]; | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 657 | if (entry.nodeName.toLowerCase() == 'div' && entry.getAttribute("class") == "footnote") | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 658 | entriesToRemove.push(entry); | 
|  | 659 | } | 
|  | 660 | for (i = 0; i < entriesToRemove.length; i++) { | 
|  | 661 | noteholder.removeChild(entriesToRemove[i]); | 
|  | 662 | } | 
|  | 663 |  | 
|  | 664 | // Rebuild footnote entries. | 
|  | 665 | var cont = document.getElementById("content"); | 
|  | 666 | var spans = cont.getElementsByTagName("span"); | 
|  | 667 | var refs = {}; | 
|  | 668 | var n = 0; | 
|  | 669 | for (i=0; i<spans.length; i++) { | 
|  | 670 | if (spans[i].className == "footnote") { | 
|  | 671 | n++; | 
|  | 672 | var note = spans[i].getAttribute("data-note"); | 
|  | 673 | if (!note) { | 
|  | 674 | // Use [\s\S] in place of . so multi-line matches work. | 
|  | 675 | // Because JavaScript has no s (dotall) regex flag. | 
|  | 676 | note = spans[i].innerHTML.match(/\s*\[([\s\S]*)]\s*/)[1]; | 
|  | 677 | spans[i].innerHTML = | 
|  | 678 | "[<a id='_footnoteref_" + n + "' href='#_footnote_" + n + | 
|  | 679 | "' title='View footnote' class='footnote'>" + n + "</a>]"; | 
|  | 680 | spans[i].setAttribute("data-note", note); | 
|  | 681 | } | 
|  | 682 | noteholder.innerHTML += | 
|  | 683 | "<div class='footnote' id='_footnote_" + n + "'>" + | 
|  | 684 | "<a href='#_footnoteref_" + n + "' title='Return to text'>" + | 
|  | 685 | n + "</a>. " + note + "</div>"; | 
|  | 686 | var id =spans[i].getAttribute("id"); | 
|  | 687 | if (id != null) refs["#"+id] = n; | 
|  | 688 | } | 
|  | 689 | } | 
|  | 690 | if (n == 0) | 
|  | 691 | noteholder.parentNode.removeChild(noteholder); | 
|  | 692 | else { | 
|  | 693 | // Process footnoterefs. | 
|  | 694 | for (i=0; i<spans.length; i++) { | 
|  | 695 | if (spans[i].className == "footnoteref") { | 
|  | 696 | var href = spans[i].getElementsByTagName("a")[0].getAttribute("href"); | 
|  | 697 | href = href.match(/#.*/)[0]; // Because IE return full URL. | 
|  | 698 | n = refs[href]; | 
|  | 699 | spans[i].innerHTML = | 
|  | 700 | "[<a href='#_footnote_" + n + | 
|  | 701 | "' title='View footnote' class='footnote'>" + n + "</a>]"; | 
|  | 702 | } | 
|  | 703 | } | 
|  | 704 | } | 
|  | 705 | }, | 
|  | 706 |  | 
|  | 707 | install: function(toclevels) { | 
|  | 708 | var timerId; | 
|  | 709 |  | 
|  | 710 | function reinstall() { | 
|  | 711 | asciidoc.footnotes(); | 
|  | 712 | if (toclevels) { | 
|  | 713 | asciidoc.toc(toclevels); | 
|  | 714 | } | 
|  | 715 | } | 
|  | 716 |  | 
|  | 717 | function reinstallAndRemoveTimer() { | 
|  | 718 | clearInterval(timerId); | 
|  | 719 | reinstall(); | 
|  | 720 | } | 
|  | 721 |  | 
|  | 722 | timerId = setInterval(reinstall, 500); | 
|  | 723 | if (document.addEventListener) | 
|  | 724 | document.addEventListener("DOMContentLoaded", reinstallAndRemoveTimer, false); | 
|  | 725 | else | 
|  | 726 | window.onload = reinstallAndRemoveTimer; | 
|  | 727 | } | 
|  | 728 |  | 
|  | 729 | } | 
|  | 730 | asciidoc.install(); | 
|  | 731 | /*]]>*/ | 
|  | 732 | </script> | 
|  | 733 | </head> | 
|  | 734 | <body class="article"> | 
|  | 735 | <div id="header"> | 
|  | 736 | <h1>HTTP transfer protocols</h1> | 
|  | 737 | </div> | 
|  | 738 | <div id="content"> | 
|  | 739 | <div id="preamble"> | 
|  | 740 | <div class="sectionbody"> | 
|  | 741 | <div class="paragraph"><p>Git supports two HTTP based transfer protocols. A "dumb" protocol | 
|  | 742 | which requires only a standard HTTP server on the server end of the | 
|  | 743 | connection, and a "smart" protocol which requires a Git aware CGI | 
|  | 744 | (or server module). This document describes both protocols.</p></div> | 
|  | 745 | <div class="paragraph"><p>As a design feature smart clients can automatically upgrade "dumb" | 
|  | 746 | protocol URLs to smart URLs. This permits all users to have the | 
|  | 747 | same published URL, and the peers automatically select the most | 
|  | 748 | efficient transport available to them.</p></div> | 
|  | 749 | </div> | 
|  | 750 | </div> | 
|  | 751 | <div class="sect1"> | 
|  | 752 | <h2 id="_url_format">URL Format</h2> | 
|  | 753 | <div class="sectionbody"> | 
|  | 754 | <div class="paragraph"><p>URLs for Git repositories accessed by HTTP use the standard HTTP | 
|  | 755 | URL syntax documented by RFC 1738, so they are of the form:</p></div> | 
|  | 756 | <div class="literalblock"> | 
|  | 757 | <div class="content"> | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 758 | <pre><code>http://<host>:<port>/<path>?<searchpart></code></pre> | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 759 | </div></div> | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 760 | <div class="paragraph"><p>Within this documentation the placeholder <code>$GIT_URL</code> will stand for | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 761 | the http:// repository URL entered by the end-user.</p></div> | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 762 | <div class="paragraph"><p>Servers SHOULD handle all requests to locations matching <code>$GIT_URL</code>, as | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 763 | both the "smart" and "dumb" HTTP protocols used by Git operate | 
|  | 764 | by appending additional path components onto the end of the user | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 765 | supplied <code>$GIT_URL</code> string.</p></div> | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 766 | <div class="paragraph"><p>An example of a dumb client requesting for a loose object:</p></div> | 
|  | 767 | <div class="literalblock"> | 
|  | 768 | <div class="content"> | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 769 | <pre><code>$GIT_URL: http://example.com:8080/git/repo.git | 
|  | 770 | URL request: http://example.com:8080/git/repo.git/objects/d0/49f6c27a2244e12041955e262a404c7faba355</code></pre> | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 771 | </div></div> | 
|  | 772 | <div class="paragraph"><p>An example of a smart request to a catch-all gateway:</p></div> | 
|  | 773 | <div class="literalblock"> | 
|  | 774 | <div class="content"> | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 775 | <pre><code>$GIT_URL: http://example.com/daemon.cgi?svc=git&q= | 
|  | 776 | URL request: http://example.com/daemon.cgi?svc=git&q=/info/refs&service=git-receive-pack</code></pre> | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 777 | </div></div> | 
|  | 778 | <div class="paragraph"><p>An example of a request to a submodule:</p></div> | 
|  | 779 | <div class="literalblock"> | 
|  | 780 | <div class="content"> | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 781 | <pre><code>$GIT_URL: http://example.com/git/repo.git/path/submodule.git | 
|  | 782 | URL request: http://example.com/git/repo.git/path/submodule.git/info/refs</code></pre> | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 783 | </div></div> | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 784 | <div class="paragraph"><p>Clients MUST strip a trailing <code>/</code>, if present, from the user supplied | 
|  | 785 | <code>$GIT_URL</code> string to prevent empty path tokens (<code>//</code>) from appearing | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 786 | in any URL sent to a server. Compatible clients MUST expand | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 787 | <code>$GIT_URL/info/refs</code> as <code>foo/info/refs</code> and not <code>foo//info/refs</code>.</p></div> | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 788 | </div> | 
|  | 789 | </div> | 
|  | 790 | <div class="sect1"> | 
|  | 791 | <h2 id="_authentication">Authentication</h2> | 
|  | 792 | <div class="sectionbody"> | 
|  | 793 | <div class="paragraph"><p>Standard HTTP authentication is used if authentication is required | 
|  | 794 | to access a repository, and MAY be configured and enforced by the | 
|  | 795 | HTTP server software.</p></div> | 
|  | 796 | <div class="paragraph"><p>Because Git repositories are accessed by standard path components | 
|  | 797 | server administrators MAY use directory based permissions within | 
|  | 798 | their HTTP server to control repository access.</p></div> | 
| Junio C Hamano | 38d0253 | 2014-06-26 21:48:50 | [diff] [blame] | 799 | <div class="paragraph"><p>Clients SHOULD support Basic authentication as described by RFC 2617. | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 800 | Servers SHOULD support Basic authentication by relying upon the | 
|  | 801 | HTTP server placed in front of the Git server software.</p></div> | 
|  | 802 | <div class="paragraph"><p>Servers SHOULD NOT require HTTP cookies for the purposes of | 
|  | 803 | authentication or access control.</p></div> | 
|  | 804 | <div class="paragraph"><p>Clients and servers MAY support other common forms of HTTP based | 
|  | 805 | authentication, such as Digest authentication.</p></div> | 
|  | 806 | </div> | 
|  | 807 | </div> | 
|  | 808 | <div class="sect1"> | 
|  | 809 | <h2 id="_ssl">SSL</h2> | 
|  | 810 | <div class="sectionbody"> | 
|  | 811 | <div class="paragraph"><p>Clients and servers SHOULD support SSL, particularly to protect | 
|  | 812 | passwords when relying on Basic HTTP authentication.</p></div> | 
|  | 813 | </div> | 
|  | 814 | </div> | 
|  | 815 | <div class="sect1"> | 
|  | 816 | <h2 id="_session_state">Session State</h2> | 
|  | 817 | <div class="sectionbody"> | 
|  | 818 | <div class="paragraph"><p>The Git over HTTP protocol (much like HTTP itself) is stateless | 
|  | 819 | from the perspective of the HTTP server side. All state MUST be | 
|  | 820 | retained and managed by the client process. This permits simple | 
|  | 821 | round-robin load-balancing on the server side, without needing to | 
|  | 822 | worry about state management.</p></div> | 
|  | 823 | <div class="paragraph"><p>Clients MUST NOT require state management on the server side in | 
|  | 824 | order to function correctly.</p></div> | 
|  | 825 | <div class="paragraph"><p>Servers MUST NOT require HTTP cookies in order to function correctly. | 
|  | 826 | Clients MAY store and forward HTTP cookies during request processing | 
|  | 827 | as described by RFC 2616 (HTTP/1.1). Servers SHOULD ignore any | 
|  | 828 | cookies sent by a client.</p></div> | 
|  | 829 | </div> | 
|  | 830 | </div> | 
|  | 831 | <div class="sect1"> | 
|  | 832 | <h2 id="_general_request_processing">General Request Processing</h2> | 
|  | 833 | <div class="sectionbody"> | 
|  | 834 | <div class="paragraph"><p>Except where noted, all standard HTTP behavior SHOULD be assumed | 
|  | 835 | by both client and server. This includes (but is not necessarily | 
|  | 836 | limited to):</p></div> | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 837 | <div class="paragraph"><p>If there is no repository at <code>$GIT_URL</code>, or the resource pointed to by a | 
|  | 838 | location matching <code>$GIT_URL</code> does not exist, the server MUST NOT respond | 
|  | 839 | with <code>200 OK</code> response. A server SHOULD respond with | 
|  | 840 | <code>404 Not Found</code>, <code>410 Gone</code>, or any other suitable HTTP status code | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 841 | which does not imply the resource exists as requested.</p></div> | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 842 | <div class="paragraph"><p>If there is a repository at <code>$GIT_URL</code>, but access is not currently | 
|  | 843 | permitted, the server MUST respond with the <code>403 Forbidden</code> HTTP | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 844 | status code.</p></div> | 
|  | 845 | <div class="paragraph"><p>Servers SHOULD support both HTTP 1.0 and HTTP 1.1. | 
|  | 846 | Servers SHOULD support chunked encoding for both request and response | 
|  | 847 | bodies.</p></div> | 
|  | 848 | <div class="paragraph"><p>Clients SHOULD support both HTTP 1.0 and HTTP 1.1. | 
|  | 849 | Clients SHOULD support chunked encoding for both request and response | 
|  | 850 | bodies.</p></div> | 
|  | 851 | <div class="paragraph"><p>Servers MAY return ETag and/or Last-Modified headers.</p></div> | 
|  | 852 | <div class="paragraph"><p>Clients MAY revalidate cached entities by including If-Modified-Since | 
|  | 853 | and/or If-None-Match request headers.</p></div> | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 854 | <div class="paragraph"><p>Servers MAY return <code>304 Not Modified</code> if the relevant headers appear | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 855 | in the request and the entity has not changed. Clients MUST treat | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 856 | <code>304 Not Modified</code> identical to <code>200 OK</code> by reusing the cached entity.</p></div> | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 857 | <div class="paragraph"><p>Clients MAY reuse a cached entity without revalidation if the | 
|  | 858 | Cache-Control and/or Expires header permits caching. Clients and | 
|  | 859 | servers MUST follow RFC 2616 for cache controls.</p></div> | 
|  | 860 | </div> | 
|  | 861 | </div> | 
|  | 862 | <div class="sect1"> | 
|  | 863 | <h2 id="_discovering_references">Discovering References</h2> | 
|  | 864 | <div class="sectionbody"> | 
|  | 865 | <div class="paragraph"><p>All HTTP clients MUST begin either a fetch or a push exchange by | 
|  | 866 | discovering the references available on the remote repository.</p></div> | 
|  | 867 | <div class="sect2"> | 
|  | 868 | <h3 id="_dumb_clients">Dumb Clients</h3> | 
|  | 869 | <div class="paragraph"><p>HTTP clients that only support the "dumb" protocol MUST discover | 
|  | 870 | references by making a request for the special info/refs file of | 
|  | 871 | the repository.</p></div> | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 872 | <div class="paragraph"><p>Dumb HTTP clients MUST make a <code>GET</code> request to <code>$GIT_URL/info/refs</code>, | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 873 | without any search/query parameters.</p></div> | 
|  | 874 | <div class="literalblock"> | 
|  | 875 | <div class="content"> | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 876 | <pre><code>C: GET $GIT_URL/info/refs HTTP/1.0</code></pre> | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 877 | </div></div> | 
|  | 878 | <div class="literalblock"> | 
|  | 879 | <div class="content"> | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 880 | <pre><code>S: 200 OK | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 881 | S: | 
|  | 882 | S: 95dcfa3633004da0049d3d0fa03f80589cbcaf31 refs/heads/maint | 
|  | 883 | S: d049f6c27a2244e12041955e262a404c7faba355 refs/heads/master | 
|  | 884 | S: 2cb58b79488a98d2721cea644875a8dd0026b115 refs/tags/v1.0 | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 885 | S: a3c2e2402b99163d1d59756e5f207ae21cccba4c refs/tags/v1.0^{}</code></pre> | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 886 | </div></div> | 
|  | 887 | <div class="paragraph"><p>The Content-Type of the returned info/refs entity SHOULD be | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 888 | <code>text/plain; charset=utf-8</code>, but MAY be any content type. | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 889 | Clients MUST NOT attempt to validate the returned Content-Type. | 
|  | 890 | Dumb servers MUST NOT return a return type starting with | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 891 | <code>application/x-git-</code>.</p></div> | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 892 | <div class="paragraph"><p>Cache-Control headers MAY be returned to disable caching of the | 
|  | 893 | returned entity.</p></div> | 
|  | 894 | <div class="paragraph"><p>When examining the response clients SHOULD only examine the HTTP | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 895 | status code. Valid responses are <code>200 OK</code>, or <code>304 Not Modified</code>.</p></div> | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 896 | <div class="paragraph"><p>The returned content is a UNIX formatted text file describing | 
|  | 897 | each ref and its known value. The file SHOULD be sorted by name | 
|  | 898 | according to the C locale ordering. The file SHOULD NOT include | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 899 | the default ref named <code>HEAD</code>.</p></div> | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 900 | <div class="literalblock"> | 
|  | 901 | <div class="content"> | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 902 | <pre><code>info_refs = *( ref_record ) | 
|  | 903 | ref_record = any_ref / peeled_ref</code></pre> | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 904 | </div></div> | 
|  | 905 | <div class="literalblock"> | 
|  | 906 | <div class="content"> | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 907 | <pre><code>any_ref = obj-id HTAB refname LF | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 908 | peeled_ref = obj-id HTAB refname LF | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 909 | obj-id HTAB refname "^{}" LF</code></pre> | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 910 | </div></div> | 
|  | 911 | </div> | 
|  | 912 | <div class="sect2"> | 
|  | 913 | <h3 id="_smart_clients">Smart Clients</h3> | 
|  | 914 | <div class="paragraph"><p>HTTP clients that support the "smart" protocol (or both the | 
|  | 915 | "smart" and "dumb" protocols) MUST discover references by making | 
|  | 916 | a parameterized request for the info/refs file of the repository.</p></div> | 
|  | 917 | <div class="paragraph"><p>The request MUST contain exactly one query parameter, | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 918 | <code>service=$servicename</code>, where <code>$servicename</code> MUST be the service | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 919 | name the client wishes to contact to complete the operation. | 
|  | 920 | The request MUST NOT contain additional query parameters.</p></div> | 
|  | 921 | <div class="literalblock"> | 
|  | 922 | <div class="content"> | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 923 | <pre><code>C: GET $GIT_URL/info/refs?service=git-upload-pack HTTP/1.0</code></pre> | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 924 | </div></div> | 
|  | 925 | <div class="paragraph"><p>dumb server reply:</p></div> | 
|  | 926 | <div class="literalblock"> | 
|  | 927 | <div class="content"> | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 928 | <pre><code>S: 200 OK | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 929 | S: | 
|  | 930 | S: 95dcfa3633004da0049d3d0fa03f80589cbcaf31 refs/heads/maint | 
|  | 931 | S: d049f6c27a2244e12041955e262a404c7faba355 refs/heads/master | 
|  | 932 | S: 2cb58b79488a98d2721cea644875a8dd0026b115 refs/tags/v1.0 | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 933 | S: a3c2e2402b99163d1d59756e5f207ae21cccba4c refs/tags/v1.0^{}</code></pre> | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 934 | </div></div> | 
|  | 935 | <div class="paragraph"><p>smart server reply:</p></div> | 
|  | 936 | <div class="literalblock"> | 
|  | 937 | <div class="content"> | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 938 | <pre><code>S: 200 OK | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 939 | S: Content-Type: application/x-git-upload-pack-advertisement | 
|  | 940 | S: Cache-Control: no-cache | 
|  | 941 | S: | 
|  | 942 | S: 001e# service=git-upload-pack\n | 
|  | 943 | S: 004895dcfa3633004da0049d3d0fa03f80589cbcaf31 refs/heads/maint\0multi_ack\n | 
|  | 944 | S: 0042d049f6c27a2244e12041955e262a404c7faba355 refs/heads/master\n | 
|  | 945 | S: 003c2cb58b79488a98d2721cea644875a8dd0026b115 refs/tags/v1.0\n | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 946 | S: 003fa3c2e2402b99163d1d59756e5f207ae21cccba4c refs/tags/v1.0^{}\n</code></pre> | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 947 | </div></div> | 
| Junio C Hamano | 912712b | 2017-12-06 18:04:01 | [diff] [blame] | 948 | <div class="paragraph"><p>The client may send Extra Parameters (see | 
|  | 949 | Documentation/technical/pack-protocol.txt) as a colon-separated string | 
|  | 950 | in the Git-Protocol HTTP header.</p></div> | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 951 | <div class="sect3"> | 
|  | 952 | <h4 id="_dumb_server_response">Dumb Server Response</h4> | 
|  | 953 | <div class="paragraph"><p>Dumb servers MUST respond with the dumb server reply format.</p></div> | 
|  | 954 | <div class="paragraph"><p>See the prior section under dumb clients for a more detailed | 
|  | 955 | description of the dumb server response.</p></div> | 
|  | 956 | </div> | 
|  | 957 | <div class="sect3"> | 
|  | 958 | <h4 id="_smart_server_response">Smart Server Response</h4> | 
|  | 959 | <div class="paragraph"><p>If the server does not recognize the requested service name, or the | 
|  | 960 | requested service name has been disabled by the server administrator, | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 961 | the server MUST respond with the <code>403 Forbidden</code> HTTP status code.</p></div> | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 962 | <div class="paragraph"><p>Otherwise, smart servers MUST respond with the smart server reply | 
|  | 963 | format for the requested service name.</p></div> | 
|  | 964 | <div class="paragraph"><p>Cache-Control headers SHOULD be used to disable caching of the | 
|  | 965 | returned entity.</p></div> | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 966 | <div class="paragraph"><p>The Content-Type MUST be <code>application/x-$servicename-advertisement</code>. | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 967 | Clients SHOULD fall back to the dumb protocol if another content | 
|  | 968 | type is returned. When falling back to the dumb protocol clients | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 969 | SHOULD NOT make an additional request to <code>$GIT_URL/info/refs</code>, but | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 970 | instead SHOULD use the response already in hand. Clients MUST NOT | 
|  | 971 | continue if they do not support the dumb protocol.</p></div> | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 972 | <div class="paragraph"><p>Clients MUST validate the status code is either <code>200 OK</code> or | 
|  | 973 | <code>304 Not Modified</code>.</p></div> | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 974 | <div class="paragraph"><p>Clients MUST validate the first five bytes of the response entity | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 975 | matches the regex <code>^[0-9a-f]{4}#</code>. If this test fails, clients | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 976 | MUST NOT continue.</p></div> | 
|  | 977 | <div class="paragraph"><p>Clients MUST parse the entire response as a sequence of pkt-line | 
|  | 978 | records.</p></div> | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 979 | <div class="paragraph"><p>Clients MUST verify the first pkt-line is <code># service=$servicename</code>. | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 980 | Servers MUST set $servicename to be the request parameter value. | 
|  | 981 | Servers SHOULD include an LF at the end of this line. | 
|  | 982 | Clients MUST ignore an LF at the end of the line.</p></div> | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 983 | <div class="paragraph"><p>Servers MUST terminate the response with the magic <code>0000</code> end | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 984 | pkt-line marker.</p></div> | 
|  | 985 | <div class="paragraph"><p>The returned response is a pkt-line stream describing each ref and | 
|  | 986 | its known value. The stream SHOULD be sorted by name according to | 
|  | 987 | the C locale ordering. The stream SHOULD include the default ref | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 988 | named <code>HEAD</code> as the first ref. The stream MUST include capability | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 989 | declarations behind a NUL on the first ref.</p></div> | 
| Junio C Hamano | 912712b | 2017-12-06 18:04:01 | [diff] [blame] | 990 | <div class="paragraph"><p>The returned response contains "version 1" if "version=1" was sent as an | 
|  | 991 | Extra Parameter.</p></div> | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 992 | <div class="literalblock"> | 
|  | 993 | <div class="content"> | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 994 | <pre><code>smart_reply = PKT-LINE("# service=$servicename" LF) | 
| Junio C Hamano | 912712b | 2017-12-06 18:04:01 | [diff] [blame] | 995 | *1("version 1") | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 996 | ref_list | 
|  | 997 | "0000" | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 998 | ref_list = empty_list / non_empty_list</code></pre> | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 999 | </div></div> | 
|  | 1000 | <div class="literalblock"> | 
|  | 1001 | <div class="content"> | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1002 | <pre><code>empty_list = PKT-LINE(zero-id SP "capabilities^{}" NUL cap-list LF)</code></pre> | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 1003 | </div></div> | 
|  | 1004 | <div class="literalblock"> | 
|  | 1005 | <div class="content"> | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1006 | <pre><code>non_empty_list = PKT-LINE(obj-id SP name NUL cap_list LF) | 
|  | 1007 | *ref_record</code></pre> | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 1008 | </div></div> | 
|  | 1009 | <div class="literalblock"> | 
|  | 1010 | <div class="content"> | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1011 | <pre><code>cap-list = capability *(SP capability) | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 1012 | capability = 1*(LC_ALPHA / DIGIT / "-" / "_") | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1013 | LC_ALPHA = %x61-7A</code></pre> | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 1014 | </div></div> | 
|  | 1015 | <div class="literalblock"> | 
|  | 1016 | <div class="content"> | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1017 | <pre><code>ref_record = any_ref / peeled_ref | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 1018 | any_ref = PKT-LINE(obj-id SP name LF) | 
|  | 1019 | peeled_ref = PKT-LINE(obj-id SP name LF) | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1020 | PKT-LINE(obj-id SP name "^{}" LF</code></pre> | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 1021 | </div></div> | 
|  | 1022 | </div> | 
|  | 1023 | </div> | 
|  | 1024 | </div> | 
|  | 1025 | </div> | 
|  | 1026 | <div class="sect1"> | 
|  | 1027 | <h2 id="_smart_service_git_upload_pack">Smart Service git-upload-pack</h2> | 
|  | 1028 | <div class="sectionbody"> | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1029 | <div class="paragraph"><p>This service reads from the repository pointed to by <code>$GIT_URL</code>.</p></div> | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 1030 | <div class="paragraph"><p>Clients MUST first perform ref discovery with | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1031 | <code>$GIT_URL/info/refs?service=git-upload-pack</code>.</p></div> | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 1032 | <div class="literalblock"> | 
|  | 1033 | <div class="content"> | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1034 | <pre><code>C: POST $GIT_URL/git-upload-pack HTTP/1.0 | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 1035 | C: Content-Type: application/x-git-upload-pack-request | 
|  | 1036 | C: | 
|  | 1037 | C: 0032want 0a53e9ddeaddad63ad106860237bbf53411d11a7\n | 
|  | 1038 | C: 0032have 441b40d833fdfa93eb2908e52742248faf0ee993\n | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1039 | C: 0000</code></pre> | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 1040 | </div></div> | 
|  | 1041 | <div class="literalblock"> | 
|  | 1042 | <div class="content"> | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1043 | <pre><code>S: 200 OK | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 1044 | S: Content-Type: application/x-git-upload-pack-result | 
|  | 1045 | S: Cache-Control: no-cache | 
|  | 1046 | S: | 
|  | 1047 | S: ....ACK %s, continue | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1048 | S: ....NAK</code></pre> | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 1049 | </div></div> | 
|  | 1050 | <div class="paragraph"><p>Clients MUST NOT reuse or revalidate a cached response. | 
|  | 1051 | Servers MUST include sufficient Cache-Control headers | 
|  | 1052 | to prevent caching of the response.</p></div> | 
|  | 1053 | <div class="paragraph"><p>Servers SHOULD support all capabilities defined here.</p></div> | 
|  | 1054 | <div class="paragraph"><p>Clients MUST send at least one "want" command in the request body. | 
|  | 1055 | Clients MUST NOT reference an id in a "want" command which did not | 
|  | 1056 | appear in the response obtained through ref discovery unless the | 
| Junio C Hamano | 85f1fde | 2015-06-01 20:37:32 | [diff] [blame] | 1057 | server advertises capability <code>allow-tip-sha1-in-want</code> or | 
|  | 1058 | <code>allow-reachable-sha1-in-want</code>.</p></div> | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 1059 | <div class="literalblock"> | 
|  | 1060 | <div class="content"> | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1061 | <pre><code>compute_request = want_list | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 1062 | have_list | 
|  | 1063 | request_end | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1064 | request_end = "0000" / "done"</code></pre> | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 1065 | </div></div> | 
|  | 1066 | <div class="literalblock"> | 
|  | 1067 | <div class="content"> | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1068 | <pre><code>want_list = PKT-LINE(want NUL cap_list LF) | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 1069 | *(want_pkt) | 
|  | 1070 | want_pkt = PKT-LINE(want LF) | 
|  | 1071 | want = "want" SP id | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1072 | cap_list = *(SP capability) SP</code></pre> | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 1073 | </div></div> | 
|  | 1074 | <div class="literalblock"> | 
|  | 1075 | <div class="content"> | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1076 | <pre><code>have_list = *PKT-LINE("have" SP id LF)</code></pre> | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 1077 | </div></div> | 
|  | 1078 | <div class="paragraph"><p>TODO: Document this further.</p></div> | 
|  | 1079 | <div class="sect2"> | 
|  | 1080 | <h3 id="_the_negotiation_algorithm">The Negotiation Algorithm</h3> | 
|  | 1081 | <div class="paragraph"><p>The computation to select the minimal pack proceeds as follows | 
|  | 1082 | (C = client, S = server):</p></div> | 
|  | 1083 | <div class="paragraph"><p><em>init step:</em></p></div> | 
|  | 1084 | <div class="paragraph"><p>C: Use ref discovery to obtain the advertised refs.</p></div> | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1085 | <div class="paragraph"><p>C: Place any object seen into set <code>advertised</code>.</p></div> | 
|  | 1086 | <div class="paragraph"><p>C: Build an empty set, <code>common</code>, to hold the objects that are later | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 1087 | determined to be on both ends.</p></div> | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1088 | <div class="paragraph"><p>C: Build a set, <code>want</code>, of the objects from <code>advertised</code> the client | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 1089 | wants to fetch, based on what it saw during ref discovery.</p></div> | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1090 | <div class="paragraph"><p>C: Start a queue, <code>c_pending</code>, ordered by commit time (popping newest | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 1091 | first). Add all client refs. When a commit is popped from | 
|  | 1092 | the queue its parents SHOULD be automatically inserted back. | 
|  | 1093 | Commits MUST only enter the queue once.</p></div> | 
|  | 1094 | <div class="paragraph"><p><em>one compute step:</em></p></div> | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1095 | <div class="paragraph"><p>C: Send one <code>$GIT_URL/git-upload-pack</code> request:</p></div> | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 1096 | <div class="literalblock"> | 
|  | 1097 | <div class="content"> | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1098 | <pre><code>C: 0032want <want #1>............................... | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 1099 | C: 0032want <want #2>............................... | 
|  | 1100 | .... | 
|  | 1101 | C: 0032have <common #1>............................. | 
|  | 1102 | C: 0032have <common #2>............................. | 
|  | 1103 | .... | 
|  | 1104 | C: 0032have <have #1>............................... | 
|  | 1105 | C: 0032have <have #2>............................... | 
|  | 1106 | .... | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1107 | C: 0000</code></pre> | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 1108 | </div></div> | 
|  | 1109 | <div class="paragraph"><p>The stream is organized into "commands", with each command | 
| Junio C Hamano | e1aeb5e | 2014-06-06 19:16:29 | [diff] [blame] | 1110 | appearing by itself in a pkt-line. Within a command line, | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 1111 | the text leading up to the first space is the command name, | 
|  | 1112 | and the remainder of the line to the first LF is the value. | 
|  | 1113 | Command lines are terminated with an LF as the last byte of | 
|  | 1114 | the pkt-line value.</p></div> | 
|  | 1115 | <div class="paragraph"><p>Commands MUST appear in the following order, if they appear | 
|  | 1116 | at all in the request stream:</p></div> | 
|  | 1117 | <div class="ulist"><ul> | 
|  | 1118 | <li> | 
|  | 1119 | <p> | 
|  | 1120 | "want" | 
|  | 1121 | </p> | 
|  | 1122 | </li> | 
|  | 1123 | <li> | 
|  | 1124 | <p> | 
|  | 1125 | "have" | 
|  | 1126 | </p> | 
|  | 1127 | </li> | 
|  | 1128 | </ul></div> | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1129 | <div class="paragraph"><p>The stream is terminated by a pkt-line flush (<code>0000</code>).</p></div> | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 1130 | <div class="paragraph"><p>A single "want" or "have" command MUST have one hex formatted | 
|  | 1131 | SHA-1 as its value. Multiple SHA-1s MUST be sent by sending | 
|  | 1132 | multiple commands.</p></div> | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1133 | <div class="paragraph"><p>The <code>have</code> list is created by popping the first 32 commits | 
|  | 1134 | from <code>c_pending</code>. Less can be supplied if <code>c_pending</code> empties.</p></div> | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 1135 | <div class="paragraph"><p>If the client has sent 256 "have" commits and has not yet | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1136 | received one of those back from <code>s_common</code>, or the client has | 
|  | 1137 | emptied <code>c_pending</code> it SHOULD include a "done" command to let | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 1138 | the server know it won’t proceed:</p></div> | 
|  | 1139 | <div class="literalblock"> | 
|  | 1140 | <div class="content"> | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1141 | <pre><code>C: 0009done</code></pre> | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 1142 | </div></div> | 
|  | 1143 | <div class="paragraph"><p>S: Parse the git-upload-pack request:</p></div> | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1144 | <div class="paragraph"><p>Verify all objects in <code>want</code> are directly reachable from refs.</p></div> | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 1145 | <div class="paragraph"><p>The server MAY walk backwards through history or through | 
|  | 1146 | the reflog to permit slightly stale requests.</p></div> | 
|  | 1147 | <div class="paragraph"><p>If no "want" objects are received, send an error: | 
|  | 1148 | TODO: Define error if no "want" lines are requested.</p></div> | 
|  | 1149 | <div class="paragraph"><p>If any "want" object is not reachable, send an error: | 
|  | 1150 | TODO: Define error if an invalid "want" is requested.</p></div> | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1151 | <div class="paragraph"><p>Create an empty list, <code>s_common</code>.</p></div> | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 1152 | <div class="paragraph"><p>If "have" was sent:</p></div> | 
|  | 1153 | <div class="paragraph"><p>Loop through the objects in the order supplied by the client.</p></div> | 
|  | 1154 | <div class="paragraph"><p>For each object, if the server has the object reachable from | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1155 | a ref, add it to <code>s_common</code>. If a commit is added to <code>s_common</code>, | 
|  | 1156 | do not add any ancestors, even if they also appear in <code>have</code>.</p></div> | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 1157 | <div class="paragraph"><p>S: Send the git-upload-pack response:</p></div> | 
|  | 1158 | <div class="paragraph"><p>If the server has found a closed set of objects to pack or the | 
|  | 1159 | request ends with "done", it replies with the pack. | 
|  | 1160 | TODO: Document the pack based response</p></div> | 
|  | 1161 | <div class="literalblock"> | 
|  | 1162 | <div class="content"> | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1163 | <pre><code>S: PACK...</code></pre> | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 1164 | </div></div> | 
|  | 1165 | <div class="paragraph"><p>The returned stream is the side-band-64k protocol supported | 
|  | 1166 | by the git-upload-pack service, and the pack is embedded into | 
|  | 1167 | stream 1. Progress messages from the server side MAY appear | 
|  | 1168 | in stream 2.</p></div> | 
|  | 1169 | <div class="paragraph"><p>Here a "closed set of objects" is defined to have at least | 
|  | 1170 | one path from every "want" to at least one "common" object.</p></div> | 
|  | 1171 | <div class="paragraph"><p>If the server needs more information, it replies with a | 
|  | 1172 | status continue response: | 
|  | 1173 | TODO: Document the non-pack response</p></div> | 
|  | 1174 | <div class="paragraph"><p>C: Parse the upload-pack response: | 
|  | 1175 | TODO: Document parsing response</p></div> | 
|  | 1176 | <div class="paragraph"><p><em>Do another compute step.</em></p></div> | 
|  | 1177 | </div> | 
|  | 1178 | </div> | 
|  | 1179 | </div> | 
|  | 1180 | <div class="sect1"> | 
|  | 1181 | <h2 id="_smart_service_git_receive_pack">Smart Service git-receive-pack</h2> | 
|  | 1182 | <div class="sectionbody"> | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1183 | <div class="paragraph"><p>This service reads from the repository pointed to by <code>$GIT_URL</code>.</p></div> | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 1184 | <div class="paragraph"><p>Clients MUST first perform ref discovery with | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1185 | <code>$GIT_URL/info/refs?service=git-receive-pack</code>.</p></div> | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 1186 | <div class="literalblock"> | 
|  | 1187 | <div class="content"> | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1188 | <pre><code>C: POST $GIT_URL/git-receive-pack HTTP/1.0 | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 1189 | C: Content-Type: application/x-git-receive-pack-request | 
|  | 1190 | C: | 
|  | 1191 | C: ....0a53e9ddeaddad63ad106860237bbf53411d11a7 441b40d833fdfa93eb2908e52742248faf0ee993 refs/heads/maint\0 report-status | 
|  | 1192 | C: 0000 | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1193 | C: PACK....</code></pre> | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 1194 | </div></div> | 
|  | 1195 | <div class="literalblock"> | 
|  | 1196 | <div class="content"> | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1197 | <pre><code>S: 200 OK | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 1198 | S: Content-Type: application/x-git-receive-pack-result | 
|  | 1199 | S: Cache-Control: no-cache | 
|  | 1200 | S: | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1201 | S: ....</code></pre> | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 1202 | </div></div> | 
|  | 1203 | <div class="paragraph"><p>Clients MUST NOT reuse or revalidate a cached response. | 
|  | 1204 | Servers MUST include sufficient Cache-Control headers | 
|  | 1205 | to prevent caching of the response.</p></div> | 
|  | 1206 | <div class="paragraph"><p>Servers SHOULD support all capabilities defined here.</p></div> | 
|  | 1207 | <div class="paragraph"><p>Clients MUST send at least one command in the request body. | 
|  | 1208 | Within the command portion of the request body clients SHOULD send | 
|  | 1209 | the id obtained through ref discovery as old_id.</p></div> | 
|  | 1210 | <div class="literalblock"> | 
|  | 1211 | <div class="content"> | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1212 | <pre><code>update_request = command_list | 
|  | 1213 | "PACK" <binary data></code></pre> | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 1214 | </div></div> | 
|  | 1215 | <div class="literalblock"> | 
|  | 1216 | <div class="content"> | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1217 | <pre><code>command_list = PKT-LINE(command NUL cap_list LF) | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 1218 | *(command_pkt) | 
|  | 1219 | command_pkt = PKT-LINE(command LF) | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1220 | cap_list = *(SP capability) SP</code></pre> | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 1221 | </div></div> | 
|  | 1222 | <div class="literalblock"> | 
|  | 1223 | <div class="content"> | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1224 | <pre><code>command = create / delete / update | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 1225 | create = zero-id SP new_id SP name | 
|  | 1226 | delete = old_id SP zero-id SP name | 
| Junio C Hamano | c14e6ad | 2014-10-31 20:25:53 | [diff] [blame] | 1227 | update = old_id SP new_id SP name</code></pre> | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 1228 | </div></div> | 
|  | 1229 | <div class="paragraph"><p>TODO: Document this further.</p></div> | 
|  | 1230 | </div> | 
|  | 1231 | </div> | 
|  | 1232 | <div class="sect1"> | 
|  | 1233 | <h2 id="_references">References</h2> | 
|  | 1234 | <div class="sectionbody"> | 
|  | 1235 | <div class="paragraph"><p><a href="http://www.ietf.org/rfc/rfc1738.txt">RFC 1738: Uniform Resource Locators (URL)</a> | 
|  | 1236 | <a href="http://www.ietf.org/rfc/rfc2616.txt">RFC 2616: Hypertext Transfer Protocol — HTTP/1.1</a> | 
|  | 1237 | link:technical/pack-protocol.html | 
|  | 1238 | link:technical/protocol-capabilities.html</p></div> | 
|  | 1239 | </div> | 
|  | 1240 | </div> | 
|  | 1241 | </div> | 
|  | 1242 | <div id="footnotes"><hr /></div> | 
|  | 1243 | <div id="footer"> | 
|  | 1244 | <div id="footer-text"> | 
| Junio C Hamano | 912712b | 2017-12-06 18:04:01 | [diff] [blame] | 1245 | Last updated 2017-12-06 10:03:34 PST | 
| Junio C Hamano | c5bd79e | 2014-01-27 21:31:26 | [diff] [blame] | 1246 | </div> | 
|  | 1247 | </div> | 
|  | 1248 | </body> | 
|  | 1249 | </html> |